using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace VotingSystem.Models
{
    public class QuestionResponse
    {
        [Key]
        public int Id { get; set; }

        [Required]
        public int SurveyResponseId { get; set; }

        [Required]
        public int QuestionId { get; set; }

        public string? TextResponse { get; set; }

        public int? RatingResponse { get; set; }

        [ForeignKey("SurveyResponseId")]
        public SurveyResponse? SurveyResponse { get; set; }

        [ForeignKey("QuestionId")]
        public SurveyQuestion? Question { get; set; }

        public virtual ICollection<OptionResponse> SelectedOptions { get; set; } = new List<OptionResponse>();

        public QuestionResponse()
        {
            SelectedOptions = new List<OptionResponse>();
        }
    }
} 